﻿
@{
    Layout = null;
}
@using FwProject.PrePaymentInfo.Dto
@using FwProject.PrePaymentInfo
@model PrePaymentInfoOutputDto

<html>
<head>

    <title>打印</title>
    <!-----------------------------【smsx.cab】打印--------------------------->
    <style media="print" type="text/css">
        body, td, th {
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 12px;
            color: #1d1007;
            line-height: 20px
        }
        /**/ /**
        *    打印相关
        */
        @@media print {
            .notprint {
                display: none;
            }

            .PageNext {
                page-break-after: always;
            }
        }

        @@media screen {
            .notprint {
                display: inline;
                cursor: hand;
            }
        }

        .text1 {
            width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .text2 {
            width: 80px;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .Noprint {
            display: none;
        }

        .PageNext {
            page-break-after: always;
        }

        * {
            word-wrap: break-word;
            word-break: break-all;
        }
    </style>
    <!--

      注意 media="print" 这个属性是说在打印时有效
      样式 Noprint：该样式的作用是在打印时隐藏样式标签（不在打印页显示该样式引用标签），
            如打印时，不需要打印，打印按钮，可将打印按钮加入样式 class="Noprint"
      样式 PageNext：该样式的作用是分页设置，如在需要分页的地方加入这样一段 <div class="PageNext"></div>  后，
            打印时就会自动在这个地方分页。
      样式 * 该样式的作用是文字自动换行。包括table、div等。
     -->
    <!-----------------------------【smsx.cab】打印--------------------------->
    @*<link type="text/css" href="/framework/styles/print.css" rel="stylesheet" />*@
    @*<script type="text/javascript" src="/scripts/util/common/smsxPrint.js?v=1"></script>*@
    <style>
        @@media print {
            INPUT {
                display: none
            }
        }
    </style>
</head>
<body>
    <!-----------------------------【smsx.cab】打印--------------------------->
    <object id="factory" viewastext style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
            codebase="/scripts/smsx.cab#Version=6,2,433,70"></object>
    <!-----------------------------【smsx.cab】打印--------------------------->
    <form name="printformName" id="printformName" action="" method="post">
        <div align="center">
            <div id="printObj" style="width: 190mm" align="center">
                <style>
                    table {
                        border-collapse: collapse;
                        border-spacing: 0px;
                    }
                </style>

                <!-----------------------------【smsx.cab】打印--------------------------->
                <!--打印前初始化设置-->
                <script language="javascript">
                    p_init({
                        portrait: true//true纵向,false横向
                    });
                </script>

                <p>
                    <input type="button" name="pagesetupBtn" value="打印设置" onclick="p_pagesetup();" />
                    <input type="button" name="previewBtn" value="打印预览" onclick="p_preview();" />
                    <input type="button" name="printBtn" value="打印" onclick="p_print();" />
                </p>
                <!-----------------------------【smsx.cab】打印--------------------------->
                <div align="center" style="font-size: 14px; margin-top: 3px; margin-bottom: 15px; font-weight: bold;">
                    @*百家消毒餐具<br />*@
                    预收单
                </div>

                <table width="100%" cellspacing="0" cellpadding="0" align="center" border="0">
                    <tr>
                        <td width="10%"><b>单号</b>:</td>
                        <td>&nbsp;@Model.PrePaymentInfoNumber</td>
                        <td width="10%"><b>日期</b>:</td>
                        <td>&nbsp;@DateTime.Now.ToString("yyyy-MM-dd")</td>

                    </tr>
                    <tr>
                        <td width="10%"><b>餐厅</b>:</td>
                        <td>&nbsp;@Model.RestaurantInfoName</td>
                        <td><b>经办人</b>:</td>
                        <td>&nbsp;@Model.AgentPeoper</td>
                    </tr>
                    <tr>
                        <td><b>账户</b>:</td>
                        <td>&nbsp;@Model.AccountName</td>
                        <td><b>预收金额</b>:</td>
                        <td>&nbsp;@Model.PrePaymentPrice</td>
                    </tr>
                    <tr>
                        <td><b>备注信息</b>:</td>
                        <td colspan="3">&nbsp;@Model.RemarkContent</td>
                    </tr>
                </table>
                <hr />
                <table style='display:;' width="100%" cellspacing="0" cellpadding="0" align="center" border=0>
                    <tr>
                        <td width="30%" align="left"><b>[制单]</b>&nbsp;@Model.AgentPeoper&nbsp;@Model.CreationTime.ToString("yyyy-MM-dd")</td>
                        @*<td width="30%" align="left"><b>[提交]</b>&nbsp;张桂清&nbsp;2018-09-23</td>
                            <td width="30%" align="center"><b>[审核]</b>&nbsp;张桂清&nbsp;2018-09-23</td>*@
                    </tr>
                </table>

            </div>
        </div>
    </form>

</body>

</html>
<script>
    function appendObject() {
        var obj = document.createElement("object");
        obj.setAttribute("id", "WebBrowser");
        obj.setAttribute("classid", "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2");
        obj.style.display = "none";
        document.body.appendChild(obj);
    }
    function p_init(printObj) {
        if (checkIE11() == -2) {
            appendObject();
            return;
        }
        printObj = printObj ? printObj : {};
        var header = (printObj.header != null) ? printObj.header : "";
        var footer = (printObj.footer != null) ? printObj.footer : "&b第&p页/共&P页&b";
        var leftMargin = printObj.leftMargin ? printObj.leftMargin : 10;//10mm
        var topMargin = printObj.topMargin ? printObj.topMargin : 10;
        var rightMargin = printObj.rightMargin ? printObj.rightMargin : 10;
        var bottomMargin = printObj.bottomMargin ? printObj.bottomMargin : 10;
        /*var portrait=true;//true纵向,false横向
        if(printObj.portrait==false){
            portrait=false;
        }*/

        try {
            if (factory && factory.printing) {
                factory.printing.header = header;//页眉
                factory.printing.footer = footer;//页脚
                if (!myIsEmpty(printObj.portrait)) {
                    var portrait = true;//true纵向,false横向
                    if (printObj.portrait == false) {
                        portrait = false;
                    }
                    factory.printing.portrait = portrait;//true纵向,false横向
                }
            }
            //		factory.printing.leftMargin = leftMargin;//左边距
            //		factory.printing.topMargin = topMargin;//上边距
            //		factory.printing.rightMargin = rightMargin;//右边距
            //		factory.printing.bottomMargin = bottomMargin;//下边距
        } catch (e) {
            if (e.description == 'Error querying the default printer') {
                alert("找不到默认打印机，请添加一个默认打印机！");
            } else {
                throw e;
            }
        }
    }
    var myIsEmpty = function (obj) {
        if (obj == null) {
            return true;
        }
        if (typeof (obj) == 'string' && jQuery.trim(obj) == '') {
            return true;
        }
        if (typeof (obj) == 'object') {
            return jQuery.isEmptyObject(obj);
        }
        return false;
    };

    /**
     * 打印预览
     */
    function p_preview() {
        try {
            factory.printing.Preview();
        } catch (e) {
            if (e.description == 'Error querying the default printer') {
                alert("找不到默认打印机，请添加一个默认打印机！");
            } else {
                //throw e;
                document.all.WebBrowser.ExecWB(7, 1);
            }
        }
    }

    /**
     * 打印设置
     */
    function p_pagesetup() {
        try {
            factory.printing.PageSetup();
        } catch (e) {
            if (e.description == 'Error querying the default printer') {
                alert("找不到默认打印机，请添加一个默认打印机！");
            } else {
                document.all.WebBrowser.ExecWB(8, 1);
                //throw e;
            }
        }
    }

    /**
     * 打印
     */
    function p_print() {
        try {
            factory.printing.Print();
        } catch (e) {
            if (e.description == 'Error querying the default printer') {
                alert("找不到默认打印机，请添加一个默认打印机！");
            } else {
                window.print();
                //throw e;
            }
        }
    }
    var ClientUtil = {};
    ClientUtil.getScreen = function () {
        return window.screen;
    };
    ClientUtil.isIE = (!!window.ActiveXObject || "ActiveXObject" in window) ? true : false;
    ClientUtil.isFF = !ClientUtil.isIE;
    ClientUtil.getIEVersion = function () {
        if (ClientUtil.isIE) {
            var userAgent = navigator.userAgent.toLowerCase();
            if (userAgent.match(/msie ([\d.]+)/) != null) {//ie6--ie9
                uaMatch = userAgent.match(/msie ([\d.]+)/);
                return parseInt(uaMatch[1]);
            } else if (userAgent.match(/(trident)\/([\w.]+)/)) {
                uaMatch = userAgent.match(/trident\/([\w.]+)/);
                switch (uaMatch[1]) {
                    case "4.0": return 8; break;
                    case "5.0": return 9; break;
                    case "6.0": return 10; break;
                    case "7.0": return 11; break;
                    default: return null;
                }
            }
            return null;
        }
        return null;
    };
    var ieVersion = (ClientUtil.getIEVersion());
    if (!ClientUtil.isIE) {
        alert("请您使用 Internet Explorer 浏览器!");
    } else {

    }
    function checkIE11(msg) {
        if (!ClientUtil.isIE) {
            if (msg) {
                alert(msg);
            }
            //alert("该功能当前仅适用于 Internet Explorer 浏览器");
            return -1;
        } else {
            if (ieVersion == 11) {
                return -2;
            } else {
                return 0;
            }
        }
    }
    function createHelp() {
        var f = document.getElementById("factory");
        var codeBase = f.getAttribute("codebase");
        var path = codeBase.split("smsx.cab")[0];
        path = path + "smsxw.rar";
        var div = document.createElement("div");
        div.className = "Noprint";
        div.style.backgroundColor = "#ccc";
        div.style.padding = "5px 0px";
        div.style.marginBottom = "5px";
        div.style.textAlign = "center";
        div.innerHTML = "<div>如页面中的打印设置、打印预览、打印按钮无效，请<a target='_blank' href='" + path + "'>[下载]</a>并安装打印软件，安装完成后刷新本页面重试。</div>";
        document.body.insertBefore(div, f);
    }
</script>
